package com.katze.boot.common.config.actuator;

import com.katze.boot.common.config.actuator.endpoint.LoggerEndpoint;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;

import java.io.File;

@ConfigurationProperties(prefix = "management.endpoint.logger")
@ConditionalOnAvailableEndpoint(LoggerEndpoint.class)
public class LoggerActuatorConfiguration {

    private File file;

    @Bean
    public LoggerEndpoint logFileEndpoint() {
        return new LoggerEndpoint(getFile());
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }
}

